//
//  PaymentTableViewCell.m
//  shanHaiHuiApp
//
//  Created by 小和尚 on 2018/3/10.
//  Copyright © 2018年 徐双. All rights reserved.
//

#import "PaymentTableViewCell.h"
@interface PaymentTableViewCell()

Strong UIImageView * picImageView;
Strong UILabel * contentLabel;
Strong UILabel * priceLabel;

@end

@implementation PaymentTableViewCell

- (instancetype)initWithCellIdentifier:(NSString *)cellID{
    self = [super initWithCellIdentifier:cellID];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        _picImageView = [UIImageView new];
        _picImageView.contentMode = UIViewContentModeScaleAspectFit;
        
        _contentLabel = [[UILabel alloc] init];
        _contentLabel.font = DEF_FontSize_14;
        _contentLabel.textColor = getColor(@"666666");
        
        _priceLabel = [[UILabel alloc] init];
        _priceLabel.font = DEF_FontSize_14;
        _priceLabel.textColor = getColor(@"323232");
        
        [self sd_addSubviews:@[self.picImageView,self.contentLabel,self.priceLabel]];
        
        [self layOutFrame];
        
    }
    return self;
}

- (void)layOutFrame{
    ws(self);
    [self.picImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(UNIT_WIDTH(15));
        make.top.mas_equalTo(UNIT_WIDTH(15));
        make.height.mas_equalTo(UNIT_HEIGHT(18));
        make.width.mas_equalTo(UNIT_WIDTH(22));
    }];
    
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
    make.left.mas_equalTo(weakself.picImageView.mas_right).offset(UNIT_WIDTH(12));
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
    [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(UNIT_WIDTH(-15));
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
}

- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.picImageView.image = [UIImage imageNamed:model[@"image"]];
    self.contentLabel.text = model[@"content"];
    self.priceLabel.text = model[@"price"];
}

@end
